<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../js/jquery-3.6.0.min.js"></script>
    <script>

        $(function () {
            $("#start").click(function () {
                let d01 = $("#d01").val();
                let d02 = $("#d02").val();

                let arr = d02.split("");
                let num = 0;
                for (let i = 0; i < arr.length; i++) {
                    let a = i+d01.length;
                    if (a>arr.length){
                        break
                    }
                    let s = d02.substring(i,a);
                    if (s===d01){
                        num++
                    }
                }
                $("#showText").html("【"+d01+"】在【"+d02+"】中一共出现了；"+num+"次")
            })
        })

    </script>
</head>
<body>

<input type="text" id="d01" value="">
<input type="text" id="d02" value="">
<button id="start">开始计算</button>
<br>
<span id="showText">111</span>
</body>
</html>